Release 10.1A: OpenEdge Data Management:
SQL Reference


LOCATE

Returns the location of the first occurrence of char_expr1 in char_expr2. If the function includes the optional integer argument start_pos, LOCATE begins searching char_expr2 at that position. If the function omits the start_pos argument, LOCATE begins its search at the beginning of char_expr2.

LOCATE denotes the first character position of a character expression as 1. If the search fails, LOCATE returns 0. If either character expression is NULL, LOCATE returns a NULL value.

Syntax

LOCATE( char_expr1 , char_expr2 , [ start_pos ] ) 

Example

In the following example, which uses two string literals as character expressions, LOCATE returns a value of 6:

SELECT LOCATE('this', 'test this test', 1) FROM TEST; 
  
LOCATE(THIS, 
------------  
6 
1 record selected 

Note

Compatibility

ODBC compatible


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095